<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Hash;
use DB;

class PasswordController extends Controller
{
   /**
    * 忘记密码页面
   */
   public function getIndex()
   {
        return view('home/password/index');
   }   

   /**
    * 修改密码
   */
    public function postUpdate(Request $request)
    {
        $s = $request -> only(['userpwd']);
        $s['userpwd'] = Hash::make($s['userpwd']);
        $res = DB::table('shop_user') -> where('tel', $request -> input('tel'))-> update($s);
        if($res){
            return view('home/password/success');
        }else{
             return view('home/password/fail');
        }
    }
}
